using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace BookShop
{
	#region Tables Struct
	public partial struct Tables
	{
		
		public static string Approval = @"Approval";
        
		public static string AspnetApplication = @"aspnet_Applications";
        
		public static string AspnetMembership = @"aspnet_Membership";
        
		public static string AspnetPath = @"aspnet_Paths";
        
		public static string AspnetPersonalizationAllUser = @"aspnet_PersonalizationAllUsers";
        
		public static string AspnetPersonalizationPerUser = @"aspnet_PersonalizationPerUser";
        
		public static string AspnetProfile = @"aspnet_Profile";
        
		public static string AspnetRole = @"aspnet_Roles";
        
		public static string AspnetSchemaVersion = @"aspnet_SchemaVersions";
        
		public static string AspnetUser = @"aspnet_Users";
        
		public static string AspnetUsersInRole = @"aspnet_UsersInRoles";
        
		public static string AspnetWebEventEvent = @"aspnet_WebEvent_Events";
        
		public static string Book = @"Book";
        
		public static string Category = @"Category";
        
		public static string Customer = @"Customer";
        
		public static string Department = @"Department";
        
		public static string Employee = @"Employee";
        
		public static string Flow = @"Flow";
        
		public static string FlowSummary = @"FlowSummary";
        
		public static string Message = @"Message";
        
		public static string Purchase = @"Purchase";
        
		public static string PurchaseApply = @"PurchaseApply";
        
		public static string PurchaseApplyDetail = @"PurchaseApplyDetail";
        
		public static string PurchaseDetail = @"PurchaseDetail";
        
		public static string PurchasePlan = @"PurchasePlan";
        
		public static string Sale = @"Sale";
        
		public static string Saledetail = @"Saledetail";
        
		public static string Stock = @"Stock";
        
		public static string Stockset = @"Stockset";
        
		public static string Supplier = @"Supplier";
        
		public static string Task = @"Task";
        
		public static string Warehouse = @"Warehouse";
        
	}
	#endregion
    #region Schemas
    public partial class Schemas {
		
		public static TableSchema.Table Approval{
            get { return DataService.GetSchema("Approval","BookShop"); }
		}
        
		public static TableSchema.Table AspnetApplication{
            get { return DataService.GetSchema("aspnet_Applications","BookShop"); }
		}
        
		public static TableSchema.Table AspnetMembership{
            get { return DataService.GetSchema("aspnet_Membership","BookShop"); }
		}
        
		public static TableSchema.Table AspnetPath{
            get { return DataService.GetSchema("aspnet_Paths","BookShop"); }
		}
        
		public static TableSchema.Table AspnetPersonalizationAllUser{
            get { return DataService.GetSchema("aspnet_PersonalizationAllUsers","BookShop"); }
		}
        
		public static TableSchema.Table AspnetPersonalizationPerUser{
            get { return DataService.GetSchema("aspnet_PersonalizationPerUser","BookShop"); }
		}
        
		public static TableSchema.Table AspnetProfile{
            get { return DataService.GetSchema("aspnet_Profile","BookShop"); }
		}
        
		public static TableSchema.Table AspnetRole{
            get { return DataService.GetSchema("aspnet_Roles","BookShop"); }
		}
        
		public static TableSchema.Table AspnetSchemaVersion{
            get { return DataService.GetSchema("aspnet_SchemaVersions","BookShop"); }
		}
        
		public static TableSchema.Table AspnetUser{
            get { return DataService.GetSchema("aspnet_Users","BookShop"); }
		}
        
		public static TableSchema.Table AspnetUsersInRole{
            get { return DataService.GetSchema("aspnet_UsersInRoles","BookShop"); }
		}
        
		public static TableSchema.Table AspnetWebEventEvent{
            get { return DataService.GetSchema("aspnet_WebEvent_Events","BookShop"); }
		}
        
		public static TableSchema.Table Book{
            get { return DataService.GetSchema("Book","BookShop"); }
		}
        
		public static TableSchema.Table Category{
            get { return DataService.GetSchema("Category","BookShop"); }
		}
        
		public static TableSchema.Table Customer{
            get { return DataService.GetSchema("Customer","BookShop"); }
		}
        
		public static TableSchema.Table Department{
            get { return DataService.GetSchema("Department","BookShop"); }
		}
        
		public static TableSchema.Table Employee{
            get { return DataService.GetSchema("Employee","BookShop"); }
		}
        
		public static TableSchema.Table Flow{
            get { return DataService.GetSchema("Flow","BookShop"); }
		}
        
		public static TableSchema.Table FlowSummary{
            get { return DataService.GetSchema("FlowSummary","BookShop"); }
		}
        
		public static TableSchema.Table Message{
            get { return DataService.GetSchema("Message","BookShop"); }
		}
        
		public static TableSchema.Table Purchase{
            get { return DataService.GetSchema("Purchase","BookShop"); }
		}
        
		public static TableSchema.Table PurchaseApply{
            get { return DataService.GetSchema("PurchaseApply","BookShop"); }
		}
        
		public static TableSchema.Table PurchaseApplyDetail{
            get { return DataService.GetSchema("PurchaseApplyDetail","BookShop"); }
		}
        
		public static TableSchema.Table PurchaseDetail{
            get { return DataService.GetSchema("PurchaseDetail","BookShop"); }
		}
        
		public static TableSchema.Table PurchasePlan{
            get { return DataService.GetSchema("PurchasePlan","BookShop"); }
		}
        
		public static TableSchema.Table Sale{
            get { return DataService.GetSchema("Sale","BookShop"); }
		}
        
		public static TableSchema.Table Saledetail{
            get { return DataService.GetSchema("Saledetail","BookShop"); }
		}
        
		public static TableSchema.Table Stock{
            get { return DataService.GetSchema("Stock","BookShop"); }
		}
        
		public static TableSchema.Table Stockset{
            get { return DataService.GetSchema("Stockset","BookShop"); }
		}
        
		public static TableSchema.Table Supplier{
            get { return DataService.GetSchema("Supplier","BookShop"); }
		}
        
		public static TableSchema.Table Task{
            get { return DataService.GetSchema("Task","BookShop"); }
		}
        
		public static TableSchema.Table Warehouse{
            get { return DataService.GetSchema("Warehouse","BookShop"); }
		}
        
	
    }
    #endregion
    #region View Struct
    public partial struct Views 
    {
		
		public static string Sysconstraint = @"sysconstraints";
        
		public static string Syssegment = @"syssegments";
        
		public static string VwAspnetApplication = @"vw_aspnet_Applications";
        
		public static string VwAspnetMembershipUser = @"vw_aspnet_MembershipUsers";
        
		public static string VwAspnetProfile = @"vw_aspnet_Profiles";
        
		public static string VwAspnetRole = @"vw_aspnet_Roles";
        
		public static string VwAspnetUser = @"vw_aspnet_Users";
        
		public static string VwAspnetUsersInRole = @"vw_aspnet_UsersInRoles";
        
		public static string VwAspnetWebPartStatePath = @"vw_aspnet_WebPartState_Paths";
        
		public static string VwAspnetWebPartStateShared = @"vw_aspnet_WebPartState_Shared";
        
		public static string VwAspnetWebPartStateUser = @"vw_aspnet_WebPartState_User";
        
    }
    #endregion
    
    #region Query Factories
	public static partial class DB
	{
        public static DataProvider _provider = DataService.Providers["BookShop"];
        static ISubSonicRepository _repository;
        public static ISubSonicRepository Repository {
            get {
                if (_repository == null)
                    return new SubSonicRepository(_provider);
                return _repository; 
            }
            set { _repository = value; }
        }
	
        public static Select SelectAllColumnsFrom<T>() where T : RecordBase<T>, new()
	    {
            return Repository.SelectAllColumnsFrom<T>();
            
	    }
	    public static Select Select()
	    {
            return Repository.Select();
	    }
	    
		public static Select Select(params string[] columns)
		{
            return Repository.Select(columns);
        }
	    
		public static Select Select(params Aggregate[] aggregates)
		{
            return Repository.Select(aggregates);
        }
   
	    public static Update Update<T>() where T : RecordBase<T>, new()
	    {
            return Repository.Update<T>();
	    }
     
	    
	    public static Insert Insert()
	    {
            return Repository.Insert();
	    }
	    
	    public static Delete Delete()
	    {
            
            return Repository.Delete();
	    }
	    
	    public static InlineQuery Query()
	    {
            
            return Repository.Query();
	    }
	    	    
	    
	}
    #endregion
    
}
#region Databases
public partial struct Databases 
{
	
	public static string BookShop = @"BookShop";
    
}
#endregion